Use case: VREFBUF configuration ¶
This use case shows how VREFBUF configuration is handled after the HAL GENERIC driver split.
Sequence diagram ¶
Code snippet ¶
|
HAL1 |
HAL2 |
|---|---|
int main(void)
{
HAL_Init();
/*
...
*/
/* Set Voltage Scaling */
HAL_SYSCFG_VREFBUF_VoltageScalingConfig(SYSCFG_VREFBUF_VOLTAGE_SCALE0);
/* Configure the high impedance mode */
HAL_SYSCFG_VREFBUF_HighImpedanceConfig(SYSCFG_VREFBUF_HIGH_IMPEDANCE_ENABLE);
/* Enable VREFBUF */
HAL_SYSCFG_EnableVREFBUF();
}
|
int main(void)
{
HAL_Init();
/*
...
*/
hal_vrefbuf_config_t p_config;
p_config.mode = HAL_VREFBUF_MODE_EXT_VOLTAGE_REF;
p_config.voltage_scale = HAL_VREFBUF_VOLTAGE_SCALE0;
/* Configure and enable VREFBUF (Voltage scale and VREFBUF mode) */
HAL_VREFBUF_SetConfig(VREFBUF1, &p_config);
}
|
Key changes ¶
The HAL GENERIC driver split introduces a dedicated VREFBUF driver for configuration.
In HAL2, VREFBUF configuration and enable are consolidated into
HAL_VREFBUF_SetConfig().

